package com.starlink.controller.wechat;

import com.starlink.common.WebResponse;
import com.starlink.common.annotation.WebAccess;
import com.github.pagehelper.PageInfo;
import com.starlink.common.annotation.client.weixin.UserPurchaseRes;
import com.starlink.model.request.UserVipPaymentRequest;
import com.starlink.service.UserVipPaymentService;
import com.starlink.model.vo.UserVipPaymentVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

/**
 * @author zhanghong
 */
@RestController
@RequestMapping("/wechat/vip")
@Api(value = "【小程序端】VIP支付记录模块", tags = {"【小程序端】VIP支付记录模块"})
public class WechatUserVipPaymentController {

    @Autowired
    private UserVipPaymentService userVipPaymentService;

    @WebAccess(login = true)
    @ApiOperation("开通VIP")
    @PostMapping("/openVip")
    public WebResponse<UserPurchaseRes> openVip(@Valid @RequestBody UserVipPaymentRequest request) {
        return WebResponse.build(userVipPaymentService.openVip(request));
    }
}
